<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

	function get_num_time($date = '2010-11-08 15:20:20'){
		$date = strtotime($date);
		$now = strtotime(date('Y-m-d H:i:s',time()));
		$i_date = mktime(date('H',$date),date('i',$date),date('s',$date),date('m',$date),date('d',$date),date('Y',$date));
		$i_now = mktime(date('H',$now ),date('i',$now ),date('s',$now ),date('m',$now ),date('d',$now ),date('Y',$now ));
		$i = $i_now-$i_date;
		$p = ceil($i/60);
		$h = 0;
		$n = 0;
		if($p > 60){
			$h = number_format($p/60,0);
			$p = ceil($p%60);
			if($h > 24){
				$n = number_format($h/24,0);
				$h = ceil($h % 24);
			}
		}
		$str = '';
		
		return ($n > 1) ? $n . ' days ago' : (($h > 1) ? $h . ' hours ago' : (($p >1) ? $p. ' minutes ago': $p. 'minute ago')) ;
	}
